package dao.proxy.comm;

import java.util.List;

import dao.comm.IStudioDAO;
import dao.impl.comm.StudioDAOImpl;
import dbc.comm.DatabaseConnection;
import vo.comm.Studio;

public class StudioDAOProxy implements IStudioDAO{
	private DatabaseConnection dbc=null;
	private IStudioDAO dao=null;
	public StudioDAOProxy() throws Exception{
		this.dbc=new DatabaseConnection();
		this.dao=new StudioDAOImpl(this.dbc.getConnection());
	}
	public boolean doJoin(Studio studio) throws Exception{
		boolean flag=false;
		if(this.dao.findById(studio.getUserid())==null){
			flag=this.dao.doJoin(studio);
		}
		this.dbc.close();
		return flag;
	}
	public Studio findById(String userid) throws Exception{
		Studio studio=null;
		studio=this.dao.findById(userid);
		this.dbc.close();
		return studio;
	}
	public List<Studio> findAll(String keyWord) throws Exception{
		List<Studio> all=null;
		all=this.dao.findAll(keyWord);
		this.dbc.close();
		return all;
	}
}
